"use strict";

/**
 * 集团/校区相关接口调用
 */
import Ajax from "../libs/ajax";
 
export function getClassgroup(query) {
    if (query.page_num === undefined || query.page_size === undefined) {
        return new Promise((resolve, reject) => {
            resolve({ code: 2011, msg: "查询参数缺失" });
        });
    }
    return Ajax.ajax({
        url: "/api/classgroup/list",
        method: "post",
        data: query
    }).then(res => res.data);
}

export function addClassgroup(data) {
    return Ajax.ajax({
        url: "/api/classgroup/add",
        data: data,
        method: "post"
    }).then(res => res.data);
}

export function updateClassgroup(data) {
    return Ajax.ajax({
        url: "/api/classgroup/update",
        data: data,
        method: "post"
    }).then(res => res.data);
}

export function deleteClassgroup(data) {
    return Ajax.ajax({
        url: "/api/classgroup/delete",
        data: data,
        method: "post"
    }).then(res => res.data);
}

export function getClasscampus(data) {
    return Ajax.ajax({
        url: "/api/classgroup/classcampus_list",
        data: data,
        method: "post"
    }).then(res => res.data);
}

export function addClasscampus(data) {
    return Ajax.ajax({
        url: "/api/classgroup/add_classcampus",
        data: data,
        method: "post"
    }).then(res => res.data);
}

export function updateClasscampus(data) {
    return Ajax.ajax({
        url: "/api/classgroup/update_classcampus",
        data: data,
        method: "post"
    }).then(res => res.data);
}

export function deleteClasscampus(data) {
    return Ajax.ajax({
        url: "/api/classgroup/delete_classcampus",
        data: data,
        method: "post"
    }).then(res => res.data);
}